<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <script src="https://cdn.jsdelivr.net/npm/vue@2.7.10/dist/vue.js"></script>
  <title>Document</title>
</head>

<body>
  <div id="app">
    <h2>{{name}}</h2>
    <hr>
    {{ipt}}
    <hr>
    <!-- <input type="text" :value="ipt" @input="fn"> -->
    <!-- <input type="text" :value="ipt" @input="ipt = $event.target.value"> -->

    <!-- v-model就是一个语法糖：:value + @input  前提是写在 <input type="text"-->
    <input type="text" v-model="ipt">
  </div>
  <script>
    let vm = new Vue({
      el:"#app",
      data() {
        return {
          name:"码路",
          ipt:123
        }
      },
      methods: {
        fn(e){
          this.ipt = e.target.value
        }
      },
    });
  </script>
</body>

</html>